<?php

class Xzsdsplus_Importplus_Model_Product extends Mage_Catalog_Model_Product
{
  
    /**
     * Quick save
     */
    public function save()
    {
        $status = Mage::getSingleton('importplus/status');
        if ($status->isImport() && $status->getStatus() && $status->getQuickImport()) {
            $this->_getResource()->beginTransaction();
            try {
                //$this->_beforeSave();
                if ($this->_dataSaveAllowed) {
                    $this->_getResource()->save($this);
                    //$this->_afterSave();
                }
                $this->_getResource()->commit();
            }
            catch (Exception $e){
                $this->_getResource()->rollBack();
                throw $e;
            }
            return $this;
        } else {
            return parent::save();
        }
        
    }
    
    /**
     * Quick delete 
     */
    public function delete() {
        $status = Mage::getSingleton('importplus/status');
        if ($status->getQuickDelete() && $status->getStatus()) {
            $this->_getResource()->beginTransaction();
            try {
                //$this->_beforeDelete();
                $this->_getResource()->delete($this);
                //$this->_afterDelete();

                $this->_getResource()->commit();
            }
            catch (Exception $e){
                $this->_getResource()->rollBack();
                throw $e;
            }
            return $this;
        } else {
            return parent::delete();
        }
    }
    
}
